/**
 * Created by Administrator on 2017/3/21.
 */
import React, {Component} from 'react';
import {Form, Input, Radio, Select,   Row,Checkbox,Col,
  Upload, } from 'antd';
import {connect} from 'dva';
import moment from 'moment'
import request from '@/utils/request';
const FormItem = Form.Item;
const { TextArea } = Input;
const RadioGroup = Radio.Group;
const Option = Select.Option;
class AddPoliciesForm extends Component {
  constructor(props) {
    super(props);
    this.state = {
      users:[]
    };
  }

  componentDidMount() {
    const that=this;
  }
  render() {
    const formItemLayoutWithLabel = {
      labelCol: {
        xs: {span: 24},
        sm: {span: 6},
      },
      wrapperCol: {
        xs: {span: 24},
        sm: {span: 15},
      }
    };

    const {getFieldDecorator} = this.props.form;
    const children = [];
    for (let i = 0; i < this.state.users.length; i++) {
      children.push(<Option key={this.state.users[i].id}>{this.state.users[i].username}</Option>);
    }
    return (
      <div>
        <Form onSubmit={this.handleSubmit}>
          <Form.Item style={{marginTop:'10px'}}  label="采集间隔(分钟)"
                     {...formItemLayoutWithLabel}
          >
            {getFieldDecorator('interval', {
              initialValue: (this.props.editRecord&&this.props.editRecord.hardware_configs.wh&&this.props.editRecord.hardware_configs.wh.collection_interval)?
                this.props.editRecord.hardware_configs.wh.collection_interval.interval:'',
              rules: [{required: true, message:'采集间隔不能为空'}],
            })(
              <Select  placeholder="请选择">
                {
                  [{type:1,name:'1'},{type:5,name:'5'},{type:10,name:'10'},{type:15,name:'15'},{type:20,name:'20'},{type:30,name:'30'},{type:60,name:'60'}].map((item,index)=>{
                    return <Option key={index} value={item.type}>
                      {item.name}
                    </Option>
                  })
                }
              </Select>,
            )}
          </Form.Item>
        </Form>
      </div>
    );
  }
}

const AddPoliciesFormWrap = Form.create()(AddPoliciesForm);
export default connect()(AddPoliciesFormWrap);


